package com.jingwu.example.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

/**
 * @author 菁芜
 * @since 2021/11/20 - 14:54
 */
@Service
public class FooService {

    public int add(int a, int b) {
        return a + b;
    }

    public int max(List<Integer> numbers) {
        if (CollectionUtils.isEmpty(numbers)) {
            throw new IllegalArgumentException("参数异常");
        }
        return numbers.stream().max(Integer::compare).get();
    }

}
